var express = require('express')
var path = require('path')

var port = process.env.PORT || 3000

var app = express()


app.set('views', ['./app'])

app.set('view engine', 'jade')

app.use(express.static(path.join(__dirname, '../app')))
app.listen(port)

console.log('service is running at ' + port)

app.get('/', function(req, res){
	res.render('index',{
		title: "首页"
	})
})

app.get('/:page', function(req, res){
	console.log("page:"+req.params.page)
	var page = req.params.page
	if(page){
		res.render(page.split(".")[0], {
			title: page
		})
	}
})

